﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class upd_infor : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!func.isinfor(Session["usr"].ToString()))
        {
            Response.Write("<script>alert('您还没有填写基本信息，填写后重试');location.href='add_user_infor.aspx';</script>");

        }
        else
        {
            Session["money"] = null;
            DataSet ds = func.ds(Session["usr"].ToString());
            txtxm.Text = ds.Tables[0].Rows[0][1].ToString();
            txtjg.Text = ds.Tables[0].Rows[0][3].ToString();
            txtxb.Text= ds.Tables[0].Rows[0][2].ToString();
            txtid.Text= ds.Tables[0].Rows[0][4].ToString();
            txtmoney.Text= ds.Tables[0].Rows[0][5].ToString();
            Session["money"] = txtmoney.Text.ToString();
        }

    }

    protected void but_Click(object sender, EventArgs e)
    {
        if(int.Parse(txtczje.Text.Trim())<0)
        {
            Response.Write("<script>alert('充值金额不能小于零')</script>");

        }
        else
        {
            int sum = 0;
            sum = int.Parse(Session["money"].ToString()) + int.Parse(txtczje.Text.Trim());
            if(func.czje(Session["usr"].ToString(), sum))
            {
                Response.Write("<script>alert('充值成功,即将跳转到查询信息页面.....');location.href='search_infor.aspx';</script>");

            }
        }
    }
}